﻿using System.Collections.Generic;

namespace RefLib.MVC.JsonModels
{
    public class FlexigridJsonModel
    {
        public class Request
        {
            public enum SortOrder
            {
                asc,
                desc
            }

            public int page { get; set; }              // Page Number
            public int rp { get; set; }                // Results per Page
            public string qtype { get; set; }          // The name of the column for keyword seraches.
            public string query { get; set; }          // The keyword to serach for.
            public string sortname { get; set; }       // The name of the column to sort.
            public SortOrder sortorder { get; set; }

            public string SortCriteria
            {
                get { return sortname + ((sortorder == SortOrder.desc) ? " desc" : ""); }
            }
        }

        public class Response
        {
            public class Row
            {
                public object cell { get; set; }
                public string id { get; set; }
            }

            public int page { get; set; }
            public List<Row> rows = new List<Row>();
            public int total { get; set; }
        }
    }
}
